/**
 * Copyright (c) iwindplus Technologies Co., Ltd.2024-2030, All rights reserved.
 */

package com.iwindplus.aider.web.service;

import cn.hutool.core.bean.BeanUtil;
import com.iwindplus.boot.domain.vo.ResultVO;
import com.iwindplus.boot.operate.domain.dto.OperateLogDTO;
import com.iwindplus.boot.operate.service.OperateLogService;
import com.iwindplus.boot.operate.service.impl.DefaultOperateLogServiceImpl;
import com.iwindplus.log.client.OperationLogClient;
import com.iwindplus.log.domain.dto.OperationLogDTO;
import jakarta.annotation.Resource;
import java.util.Optional;
import lombok.extern.slf4j.Slf4j;

/**
 * 操作日志业务层接口实现类.
 *
 * @author zengdegui
 * @since 2023/07/30 22:31
 */
@Slf4j
public class OperateLogServiceImpl extends DefaultOperateLogServiceImpl implements OperateLogService {

    @Resource
    private OperationLogClient operationLogClient;

    @Override
    public boolean save(OperateLogDTO entity) {
        OperationLogDTO param = BeanUtil.copyProperties(entity, OperationLogDTO.class);
        return Optional.ofNullable(this.operationLogClient.save(param)).map(ResultVO::getBizData).orElse(Boolean.FALSE);
    }
}
